Skip to content

Conversation

forafox
Copy link

@forafox forafox commented Oct 13, 2025

Description

This PR removes the redundant pylint: disable=attribute-defined-outside-init comment from the celery instrumentation and adds this rule to the global pylint disable list in .pylintrc.

The attribute-defined-outside-init pylint rule is problematic for OpenTelemetry instrumentations because attributes are commonly set during instrumentation (in methods like _instrument()) rather than in __init__. This pattern is used throughout the codebase (30+ occurrences) and is a standard practice for OpenTelemetry instrumentations where attributes are initialized during the instrumentation process.

By disabling this rule globally, we eliminate the need for individual pylint: disable comments across the codebase, making the code cleaner and more maintainable.

Fixes #3828

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Verified that the celery instrumentation file compiles without syntax errors
  • Confirmed that the pylint disable comment has been completely removed from celery instrumentation
  • Verified that attribute-defined-outside-init has been added to the global pylint disable list
  • Ran pylint checks to ensure no new warnings are introduced

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@forafox forafox requested a review from a team as a code owner October 13, 2025 17:47
Copy link

linux-foundation-easycla bot commented Oct 13, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@forafox forafox closed this Oct 13, 2025
@forafox forafox reopened this Oct 13, 2025
@forafox forafox force-pushed the cleanup/remove-pylint-disable-celery branch from e00110a to d501764 Compare October 14, 2025 15:59
@xrmx xrmx moved this to Reviewed PRs that need fixes in @xrmx's Python PR digest Oct 15, 2025
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to move this globally I would expect the other 30 occurences of the pylint disable to move removed too. Said that the lint warning may be useful in other cases.

@forafox forafox force-pushed the cleanup/remove-pylint-disable-celery branch from d501764 to 985b02f Compare October 15, 2025 21:43
@forafox
Copy link
Author

forafox commented Oct 15, 2025

If we are going to move this globally I would expect the other 30 occurences of the pylint disable to move removed too. Said that the lint warning may be useful in other cases.

Pull request updated
@xrmx

@forafox forafox requested a review from xrmx October 15, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

Remove pylint: disable=attribute-defined-outside-init use from celery instrumentation

2 participants